package org.jeecg.modules.demo.com.kunpeng.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.com.kunpeng.entity.dto.UpdateOaProjectCostApplyDTO;
import org.jeecg.modules.demo.com.kunpeng.service.IProjectCostApplyService;
import org.jeecg.modules.demo.com.kunpeng.vo.OaProjectCostApplyPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags="OA项目费用申请表")
@RestController
@RequestMapping("/com.kunpeng/oaProjectCostApply")
@Slf4j
public class OaProjectCostApplyController {

    @Autowired
    private IProjectCostApplyService projectCostApplyService;

    /**
     * 新增项目费用申请
     * @param oaProjectCostApplyPage
     * @return
     */
    @ApiOperation(value = "OA项目费用申请表-项目费用提交审批",notes = "OA项目费用申请表-项目费用提交审批")
    @PostMapping(value = "/saveOaProjectCostApply")
    public Result<String> saveOaProjectCostApply(@RequestBody OaProjectCostApplyPage oaProjectCostApplyPage){

        projectCostApplyService.insertOaProjectCostApply(oaProjectCostApplyPage);
        return Result.ok("提交成功！");
    }

    /**
     * 修改项目费用申请idDelete状态
     */
    @ApiOperation(value = "OA项目费用申请表-修改项目费用申请idDelete状态",notes = "OA项目费用申请表-修改项目费用申请idDelete状态")
    @GetMapping(value = "/updateProjectCostApplyIsDeleteById")
    public Result<String> updateProjectCostApplyIsDeleteById(String id){
        projectCostApplyService.updateProjectCostApplyIsDeleteById(id);
        return Result.ok("删除成功!");
    }


    /**
     * 根据id修改项目费用申请数据
     * @param updateOaProjectCostApplyDTO
     * @return
     */
    @ApiOperation(value = "OA项目费用申请表-修改项目费用申请数据",notes = "OA项目费用申请表-修改项目费用申请数据")
    @PostMapping(value = "/updateOaProjectCostApplyById")
    public Result<String> updateOaProjectCostApplyById(@RequestBody UpdateOaProjectCostApplyDTO updateOaProjectCostApplyDTO){
        System.out.println("项目费用申请修改数据："+updateOaProjectCostApplyDTO.toString());
        projectCostApplyService.updateProjectCostApplyById(updateOaProjectCostApplyDTO);
        return Result.ok("修改成功！");
    }
}

